package com.example.demo.huawei;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @Author: liull
 * @Description: 输入一行文本 7 1 2 3 4 5 6 A 第一个为数字个数遇到0x0A 替换为 0x12 0x34两个字节
 *                                          遇到0x0B 替换为 0xAB 0xCD两个字节
 *                                          输出：8 1 2 3 4 5 6 12 34
 *                                          输出不包含0x，第一个也是个数
 * @Date: Created in 15:58 2020/3/26
 * @Modified By:
 */
public class Main2 {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line;
        while ((line = br.readLine()) != null) {
            String s = line.substring(line.indexOf(' ') + 1);
            String[] split = s.split(" ");
            int countA = 0;
            int countB = 0;
            for (int i = 0; i < split.length; i++) {
                if (split[i].equals("A") || split[i].equals("0x0A")) {
                    split[i] = "12 34";
                    countA++;
                }
                if (split[i].equals("B") || split[i].equals("0x0B")) {
                    split[i] = "AB CD";
                    countB++;
                }
            }
            System.out.print(Integer.parseInt(line.substring(0, line.indexOf(' '))) + countA + countB + " ");
            for (String s1 : split) {
                System.out.print(s1 + " ");
            }
            System.out.println();
        }
    }
}
